//
//  CZLoginVC.m
//  CZWeiXin
//
//  Created by Alvechen on 16/4/10.
//  Copyright © 2016年 alvechen. All rights reserved.
//

#import "CZLoginVC.h"
#import "JHForgetPasswordVC.h"

@interface CZLoginVC ()

///账户名
@property (weak, nonatomic) IBOutlet UITextField *acountNameTF;
///密码
@property (weak, nonatomic) IBOutlet UITextField *passwordTF;

@end

@implementation CZLoginVC

- (void)viewDidLoad {
    [super viewDidLoad];
}

/**
 * 登录
 */
- (IBAction)loginClick:(UIButton *)sender {
    
    
    //使用xmpp管理者登录
    [[CZXMPPManager shareInstance] loginWithAcountName:self.acountNameTF.text password:self.passwordTF.text successHandle:^{
        
        NSLog(@"登录成功");
        
        //获取storyboard
        UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        //从sb里获取tabBarController
        UITabBarController *tabBarController = [sb instantiateViewControllerWithIdentifier:@"tabBar"];
        //切换window根控制器
        [UIApplication sharedApplication].keyWindow.rootViewController = tabBarController;
        
        
    } errorHandle:^(NSError *error) {
        
        NSLog(@"登录失败error = %@",error);
        
    }];
}











@end
